//
//  FindFunViewController.m
//  HaoHint
//
//  Created by winter on 16/5/22.
//  Copyright © 2016年 wd. All rights reserved.
//

#import "FindFunViewController.h"
#import "MediaPlayerViewController.h"

@interface FindFunViewController ()<UIAlertViewDelegate>

@end

@implementation FindFunViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"好玩";
}

- (IBAction)buttonClickedAction:(UIButton *)sender
{
//    [self showMediaPlayerView];
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"好玩" message:@"试试这个密码是什么？" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定",nil];
    
    [alertView setAlertViewStyle:UIAlertViewStyleSecureTextInput];
    UITextField *passwordField = [alertView textFieldAtIndex:0];
    passwordField.keyboardType = UIKeyboardTypeNumberPad;
    
    [alertView show];
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    UITextField *passwordField = [alertView textFieldAtIndex:0];
    [passwordField resignFirstResponder];
    if (buttonIndex == alertView.firstOtherButtonIndex) {
        NSString *password = passwordField.text;
        if ([password isEqualToString:@"0000"]) {
            [self showMediaPlayerView];
        }
    }
}

- (void)showMediaPlayerView
{
    MediaPlayerViewController *vc = [[MediaPlayerViewController alloc] init];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
//    vc.hidesBottomBarWhenPushed = YES;
//    [self.navigationController pushViewController:vc animated:YES];
    [self presentViewController:nav animated:YES completion:nil];
}
@end
